#ifndef __CLI_PARSE__LOG_FILE_H__
#define __CLI_PARSE__LOG_FILE_H__

#include "../Epsilon/file.h"

/**
 * Defines the minimum and maximum levels / severities / types, etc... that
 *   a Log File will write events to the file for...
 *
 *  The maximum level (currently) does not mean that the event will not be
 *    written, rather it means that the event will be written and then
 *      reported using a more advanced output mechansim (e.g. Message Box).
 *
**/
class eTB_LogFileBreadth
{
public:
  eTB_LogFileBreadth (void) {
    min_ = 0;
    max_ = 0;
  }

  int setMin (int min) {
    min_ = min;

    if (max_ < min)
      max_ = min;
  }

  int setMax (int max) {
    max_ = max;

    if (min_ > max)
      min_ = max;
  }

  int getMin (void) const { return min_; }
  int getMax (void) const { return max_; }

protected:
private:
  int min_;
  int max_; /* Anything above this _WILL_ be logged, but will also
                 trigger more extensive reporting.

                (e.g. prsent the user with a Message Box...) */
};

class eTB_LogFile : public eDiskFile
{
public:
  eTB_LogFile (const char* szName) {
    eStringA name (szName);

    if (! open (name, eFileMode::ReadWrite |
                      eFileMode::Append    |
                      eFileMode::Create    |
                      eFileMode::Exclusive ) ) {
      fprintf (stderr, " eTB_LogFile << Error >>: Could not open Log File: \n",
                       szName );
    }
  }
  virtual ~eTB_LogFile (void) {
    close ();
  }

  void Printf (const char* description, ...);

  void Trace   ( const char* func,
                 int         line,
                 int         type,
                 const char* description, ... );

  void Status  (int level,    const char* description, ...);
  void Warning (int severity, const char* description, ...);
  void Error   (int severity, const char* description, ...);

protected:
private:
  eTB_LogFileBreadth trace_range_;
  eTB_LogFileBreadth status_range_;
  eTB_LogFileBreadth warning_range_;
  eTB_LogFileBreadth error_range_;

  int log_flags_;
};

#endif /* __CLI_PARSE__LOG_FILE_H__ */